<?php
/**
 * 注：此模板为自动生成模板，需要根据实际情况调整修改
 * 此模板对 无主键/单一主键 表的支持较好，联合主键表在下一版本开发
 */
namespace Data;

use Utils\MyException;

class Order_for_foods {

    //数组
    private $array;


    public function __construct ($array){

        $this->array = $array;

        self::setDefault();

    }

    public function getArray() {
        return $this->array;
    }

    public function updateWithArray($array) {
        foreach($array as $key=>$value)
        {
            if(array_key_exists($key,$this->array))
            {
                $this->array = array_merge($this->array,array($key=>$value));
            }
        }
    }



    private function setDefault(){

        if(count($this->array)==0){
            self::setORDER_FORM_ID("null");
            self::setRESTAURANT_ID("0");
            self::setFOOD_ID("0");
            self::setFOOD_NAME("");
            self::setFOOD_PRICE("0");
            self::setLUNCHBOX_AMOUNTS("0");
            self::setLUNCHBOX_PRICE("0");
            self::setFOOD_COUNT("0");
            self::setFOOD_COUNT_LEFT("0");
            self::setFOOD_TAG_NAME("");
            self::setRETREAT_STATUS("0");
            self::setRETREAT_COUNT("0");
            self::setRETREAT_MONEY("0");
            self::setSUC_RETREAT_COUNT("0");
            self::setSUC_RETREAT_MONEY("0");
            self::setIS_PAY("0");
            self::setDATE("");
            self::setCREATED_ON("");
            self::setCREATED_BY("0");
            self::setUPDATED_ON("");
            self::setUPDATED_BY("0");

        }
    }






    public function setORDER_FORM_ID($value) {
        $this->array = array_merge ($this->array,array(
            'ORDER_FORM_ID' => $value));
    }
    public function getORDER_FORM_ID(){

        return $this->array ['ORDER_FORM_ID'];
    }


    public function setRESTAURANT_ID($value) {
        $this->array = array_merge ($this->array,array(
            'RESTAURANT_ID' => $value));
    }
    public function getRESTAURANT_ID(){

        return $this->array ['RESTAURANT_ID'];
    }


    public function setFOOD_ID($value) {
        $this->array = array_merge ($this->array,array(
            'FOOD_ID' => $value));
    }
    public function getFOOD_ID(){

        return $this->array ['FOOD_ID'];
    }


    public function setFOOD_NAME($value) {
        $this->array = array_merge ($this->array,array(
            'FOOD_NAME' => $value));
    }
    public function getFOOD_NAME(){

        return $this->array ['FOOD_NAME'];
    }


    public function setFOOD_PRICE($value) {
        $this->array = array_merge ($this->array,array(
            'FOOD_PRICE' => $value));
    }
    public function getFOOD_PRICE(){

        return $this->array ['FOOD_PRICE'];
    }


    public function setLUNCHBOX_AMOUNTS($value) {
        $this->array = array_merge ($this->array,array(
            'LUNCHBOX_AMOUNTS' => $value));
    }
    public function getLUNCHBOX_AMOUNTS(){

        return $this->array ['LUNCHBOX_AMOUNTS'];
    }


    public function setLUNCHBOX_PRICE($value) {
        $this->array = array_merge ($this->array,array(
            'LUNCHBOX_PRICE' => $value));
    }
    public function getLUNCHBOX_PRICE(){

        return $this->array ['LUNCHBOX_PRICE'];
    }


    public function setFOOD_COUNT($value) {
        $this->array = array_merge ($this->array,array(
            'FOOD_COUNT' => $value));
    }
    public function getFOOD_COUNT(){

        return $this->array ['FOOD_COUNT'];
    }


    public function setFOOD_COUNT_LEFT($value) {
        $this->array = array_merge ($this->array,array(
            'FOOD_COUNT_LEFT' => $value));
    }
    public function getFOOD_COUNT_LEFT(){

        return $this->array ['FOOD_COUNT_LEFT'];
    }


    public function setFOOD_TAG_NAME($value) {
        $this->array = array_merge ($this->array,array(
            'FOOD_TAG_NAME' => $value));
    }
    public function getFOOD_TAG_NAME(){

        return $this->array ['FOOD_TAG_NAME'];
    }


    public function setRETREAT_STATUS($value) {
        $this->array = array_merge ($this->array,array(
            'RETREAT_STATUS' => $value));
    }
    public function getRETREAT_STATUS(){

        return $this->array ['RETREAT_STATUS'];
    }


    public function setRETREAT_COUNT($value) {
        $this->array = array_merge ($this->array,array(
            'RETREAT_COUNT' => $value));
    }
    public function getRETREAT_COUNT(){

        return $this->array ['RETREAT_COUNT'];
    }


    public function setRETREAT_MONEY($value) {
        $this->array = array_merge ($this->array,array(
            'RETREAT_MONEY' => $value));
    }
    public function getRETREAT_MONEY(){

        return $this->array ['RETREAT_MONEY'];
    }


    public function setSUC_RETREAT_COUNT($value) {
        $this->array = array_merge ($this->array,array(
            'SUC_RETREAT_COUNT' => $value));
    }
    public function getSUC_RETREAT_COUNT(){

        return $this->array ['SUC_RETREAT_COUNT'];
    }


    public function setSUC_RETREAT_MONEY($value) {
        $this->array = array_merge ($this->array,array(
            'SUC_RETREAT_MONEY' => $value));
    }
    public function getSUC_RETREAT_MONEY(){

        return $this->array ['SUC_RETREAT_MONEY'];
    }


    public function setIS_PAY($value) {
        $this->array = array_merge ($this->array,array(
            'IS_PAY' => $value));
    }
    public function getIS_PAY(){

        return $this->array ['IS_PAY'];
    }


    public function setDATE($value) {
        $this->array = array_merge ($this->array,array(
            'DATE' => $value));
    }
    public function getDATE(){

        return $this->array ['DATE'];
    }


    public function setCREATED_ON($value) {
        $this->array = array_merge ($this->array,array(
            'CREATED_ON' => $value));
    }
    public function getCREATED_ON(){

        return $this->array ['CREATED_ON'];
    }


    public function setCREATED_BY($value) {
        $this->array = array_merge ($this->array,array(
            'CREATED_BY' => $value));
    }
    public function getCREATED_BY(){

        return $this->array ['CREATED_BY'];
    }


    public function setUPDATED_ON($value) {
        $this->array = array_merge ($this->array,array(
            'UPDATED_ON' => $value));
    }
    public function getUPDATED_ON(){

        return $this->array ['UPDATED_ON'];
    }


    public function setUPDATED_BY($value) {
        $this->array = array_merge ($this->array,array(
            'UPDATED_BY' => $value));
    }
    public function getUPDATED_BY(){

        return $this->array ['UPDATED_BY'];
    }

    public function toInsertCSV() {
        $str="";

        // ORDER_FORM_ID
        $str .= self::getORDER_FORM_ID().",";
        // RESTAURANT_ID
        $str .= "'". self::getRESTAURANT_ID()."',";
        // FOOD_ID
        $str .= "'". self::getFOOD_ID()."',";
        // FOOD_NAME
        $str .= "'". self::getFOOD_NAME()."',";
        // FOOD_PRICE
        $str .= "'". self::getFOOD_PRICE()."',";
        // LUNCHBOX_AMOUNTS
        $str .= "'". self::getLUNCHBOX_AMOUNTS()."',";
        // LUNCHBOX_PRICE
        $str .= "'". self::getLUNCHBOX_PRICE()."',";
        // FOOD_COUNT
        $str .= "'". self::getFOOD_COUNT()."',";
        // FOOD_COUNT_LEFT
        $str .= "'". self::getFOOD_COUNT_LEFT()."',";
        // FOOD_TAG_NAME
        $str .= "'". self::getFOOD_TAG_NAME()."',";
        // RETREAT_STATUS
        $str .= "'". self::getRETREAT_STATUS()."',";
        // RETREAT_COUNT
        $str .= "'". self::getRETREAT_COUNT()."',";
        // RETREAT_MONEY
        $str .= "'". self::getRETREAT_MONEY()."',";
        // SUC_RETREAT_COUNT
        $str .= "'". self::getSUC_RETREAT_COUNT()."',";
        // SUC_RETREAT_MONEY
        $str .= "'". self::getSUC_RETREAT_MONEY()."',";
        // IS_PAY
        $str .= "'". self::getIS_PAY()."',";
        // DATE
        $str .= "'". self::getDATE()."',";
        // CREATED_ON
        $str .= "now()" . ",";

        // CREATED_BY
        $str .= "'". self::getCREATED_BY()."',";
        // UPDATED_ON
        $str .= "now()" . ",";

        // UPDATED_BY
        $str .= "'". self::getUPDATED_BY()."'";
        return $str;
    }

    public function toUpdateSet() {
        $str="";

        // RESTAURANT_ID
        $str.= '`RESTAURANT_ID` = "' . self::getRESTAURANT_ID() . '",';

        // FOOD_ID
        $str.= '`FOOD_ID` = "' . self::getFOOD_ID() . '",';

        // FOOD_NAME
        $str.= '`FOOD_NAME` = "' . self::getFOOD_NAME() . '",';

        // FOOD_PRICE
        $str.= '`FOOD_PRICE` = "' . self::getFOOD_PRICE() . '",';

        // LUNCHBOX_AMOUNTS
        $str.= '`LUNCHBOX_AMOUNTS` = "' . self::getLUNCHBOX_AMOUNTS() . '",';

        // LUNCHBOX_PRICE
        $str.= '`LUNCHBOX_PRICE` = "' . self::getLUNCHBOX_PRICE() . '",';

        // FOOD_COUNT
        $str.= '`FOOD_COUNT` = "' . self::getFOOD_COUNT() . '",';

        // FOOD_COUNT_LEFT
        $str.= '`FOOD_COUNT_LEFT` = "' . self::getFOOD_COUNT_LEFT() . '",';

        // FOOD_TAG_NAME
        $str.= '`FOOD_TAG_NAME` = "' . self::getFOOD_TAG_NAME() . '",';

        // RETREAT_STATUS
        $str.= '`RETREAT_STATUS` = "' . self::getRETREAT_STATUS() . '",';

        // RETREAT_COUNT
        $str.= '`RETREAT_COUNT` = "' . self::getRETREAT_COUNT() . '",';

        // RETREAT_MONEY
        $str.= '`RETREAT_MONEY` = "' . self::getRETREAT_MONEY() . '",';

        // SUC_RETREAT_COUNT
        $str.= '`SUC_RETREAT_COUNT` = "' . self::getSUC_RETREAT_COUNT() . '",';

        // SUC_RETREAT_MONEY
        $str.= '`SUC_RETREAT_MONEY` = "' . self::getSUC_RETREAT_MONEY() . '",';

        // IS_PAY
        $str.= '`IS_PAY` = "' . self::getIS_PAY() . '",';

        // DATE
        $str.= '`DATE` = "' . self::getDATE() . '",';

        // CREATED_ON
        $str.= '`CREATED_ON` = "' . self::getCREATED_ON() . '",';

        // CREATED_BY
        $str.= '`CREATED_BY` = "' . self::getCREATED_BY() . '",';

        // UPDATED_ON
        $str .= "UPDATED_ON = now()," ;

        // UPDATED_BY
        $str.= '`UPDATED_BY` = "' . self::getUPDATED_BY(). '"';
        return $str;
    }

}


